package com.cn.zy.zheda.demo.controller;

import com.cn.zy.zheda.demo.service.AlarmService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


/**
 * 这个接口是最新的,其他都没有用了
 *
 *
 * @author zhangyi
 * @date 2018/12/19 17:52
 */
@RestController
@RequestMapping("/alarm")
public class AlarmController {

    @Resource
    private AlarmService alarmService;

    /**
     * 获取报警信息
     * @return
     */
    @GetMapping("/info/{customerId}")
    public List<Map<String,Object>> info(@PathVariable String customerId){
        customerId = customerId.replaceAll("-","");
        return alarmService.info(customerId);
    }

    /**
     * 获取报警信息,第二种方式
     * @return
     */
    @GetMapping("/boom/{customerId}")
    public Map<String,Object> boom(@PathVariable String customerId){
        customerId = customerId.replaceAll("-","");
        return alarmService.boom(customerId);
    }
}
